<template>
	<view>
		<view class="list relative">
			<view class="item">
				<u-cell-group>
					<u-cell v-for="val,i in list" :key="i" :title="val.uproductName" label="待开发">
						<view class="" slot="value">
							<!-- {{数量 | ${val.count}}} -->
							<u-modal :show="show" :content="content" showCancelButton asyncClose @confirm="confirm(i)"
								@cancel="() => show = false"></u-modal>
						</view>
					</u-cell>
				</u-cell-group>
			</view>

			<view class="fixed w-full" style="bottom: 0;">
				<view class=" flexflex  justif-between">
					<u-button type="error" @click="trueOrfalse(3)">不同意审核</u-button>
					<u-button type="primary" @click="trueOrfalse(2)">同意审核</u-button>
				</view>
				<!--  -->
				<u-gap></u-gap>
				<u-gap></u-gap>
			</view>
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				id: "",
				list: [],
				show: false,
				content: '是否确定该操作？',
				// 1待审核，2审核成功，3审核失败
				status: 1
			};
		},
		methods: {
			trueOrfalse(num) {
				console.log(num,'------------------')
				this.status = num
				this.show = true
			},
			async getGoodsById() {
				let re = await this.$API.abbreviationforApi.getGoodsById(this.id)
				console.log(re, "re");
				this.list = re.list
			},
			async confirm(index) {
				let that = this;
				let data = {
					"prescriptionId": that.id,
					"status": String(that.status)
				}
				let re = await this.$API.abbreviationforApi.abbreviationforPrescription(data)
				/* dle */
				// this.list.splice(idnex, 1)
				uni.showToast({
					title: '审核成功'
				})
			},
		},
		onLoad(options) {
			if (options.data) {
				this.id = options.data
			}
		},
		onShow() {
			this.getGoodsById()
		},
	}
</script>

<style lang="scss">

</style>